package com.wgchao.authmanager.application.service;

import com.wgchao.authmanager.domain.model.AssignAdminDomainService;
import com.wgchao.authmanager.domain.model.AssignRoleDoaminService;
import com.wgchao.authmanager.domain.model.LoginAdminDomainService;
import com.wgchao.authmanager.domain.params.AssignInfo;
import com.wgchao.authmanager.domain.params.LoginInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @作者：wgchao
 * @时间：21:21 2020/4/28 0028
 * @用途：认证授权
 **/
@Service
@Transactional(rollbackFor = Exception.class)
public class AssignService {
    @Autowired
    private AssignRoleDoaminService assignRoleDoaminService;
    @Autowired
    private AssignAdminDomainService assignAdminDomainService;

    /**
     * 角色授权
     * @param agencyCode
     * @param roleName
     * @param assignInfos
     */
    public void assignAuthosToRole(String agencyCode, String roleName, List<AssignInfo> assignInfos, String operator){
        assignRoleDoaminService.assignAuthosToRole(agencyCode, roleName, assignInfos, operator);
    }

    /**
     * 账户授权
     * @param uname
     * @param assignInfos
     */
    public void assignAuthosToAdmin(String uname, List<AssignInfo> assignInfos, String operator){
        assignAdminDomainService.assignAuthosToAdmin(uname, assignInfos, operator);
    }
}
